//
//  DIYButton.m
//  FreeTrip
//
//  Created by 352324497@qq.com on 15/11/24.
//  Copyright © 2015年 邓芮. All rights reserved.
//

#import "DIYButton.h"


@implementation DIYButton

-(void)setFrame:(CGRect)frame
{
    [_textLabel removeFromSuperview];
    [_customImageView removeFromSuperview];
    
    CGFloat x = (frame.size.width - 32 * KScreenWidth / 375) / 2;
    
    // 创建视图
    
    _customImageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, 0, 32 * KScreenWidth / 375, 32 * KScreenWidth / 375)];
    [self addSubview:self.customImageView];
    
    _textLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 32 * KScreenWidth / 375 - 10, frame.size.width, frame.size.height - 32 * KScreenWidth / 375)];
    _textLabel.textAlignment = NSTextAlignmentCenter;
    _textLabel.font = [UIFont systemFontOfSize:14 * KScreenWidth / 375];
    [self addSubview:self.textLabel];
    
    [super setFrame:frame];
}



@end
